import fetch from '@/utils/fetch';

export function getList(query) {
    query._ts = (new Date()).getTime();
    return fetch({
        url: '/operator/recommend/list',
        method: 'get',
        params: query
    });
}

export function getDetail(recommendId) {
    var _ts = (new Date()).getTime();
    return fetch({
        url: '/operator/recommend/detail',
        method: 'get',
        params: {
            recommendId,
            _ts
        }
    });
}

export function add(recommend) {
    return fetch({
        url: '/operator/recommend/add',
        method: 'post',
        data: recommend
    });
}

export function update(recommend) {
    return fetch({
        url: '/operator/recommend/update',
        method: 'post',
        data: recommend
    });
}

export function toggleStatus(recommendId, status) {
    return fetch({
        url: '/operator/recommend/status/toggle',
        method: 'post',
        data: {
            recommendId,
            status
        }
    });
}

export function updateSerial(recommendId, serial) {
    return fetch({
        url: '/operator/recommend/serial/update',
        method: 'post',
        data: {
            recommendId,
            serial
        }
    });
}